1. Field of the Invention
The present invention relates to a printer and to an information processing apparatus including the printer or for connection to the printer, as well as methods of controlling the printer and the information processing apparatus, respectively.
2. Description of the Related Art
Printers as the term is used in this text include all types of printing apparatuses used for printing text and/or graphics on various types of printing material such as paper. Typically, a printer is connected to or an integral part of some kind of information processing apparatus (simply referred to as host-device or host computer hereinafter) that controls the printer by sending to the printer a stream of data including data that represent text and graphics to be printed as well as control commands for controlling the printer itself.
The data sent from a host device to a printer can be regarded as a bit stream as well as a byte stream. Control commands are often composed of bytes, i.e., units of 8 bits, and, in many cases, of multiple bytes. Normally, a command is composed of a command identifier, one or more command parameter bytes following the command identifier when needed, and additional command data when needed. There are two main command types, a first or normal command type and a second command type, the so-called “real-time commands”. Normal commands are typically processed in the FIFO (first-in-first-out) order in which the printer receives them. Real-time commands are high priority commands that are processed with precedence over normal commands as is described in detail in EP-A-0 769 737. Real-time commands and normal commands can be distinguished from one another by means of the respective command identifiers.
An interface in the printer is provided to connect to and allow communication with a host device. When the interface receives one or more bytes of data, a receive interrupt is issued and invokes a particular interrupt process. This interrupt process comprises:                (1) Detecting whether or not a real-time command has been received and immediately executing the process corresponding to the real-time command if a real-time command has been received; and        (2) Storing the received data in a receive buffer.        
When the interrupt process is completed, the printer returns to the normal processing. In general, the interrupt process is carried out repeatedly until a CR (carriage return) is received or the receive buffer becomes full. In the normal processing, a data stream stored in the receive buffer is interpreted and, in accordance with the interpreted data, a print image (bit map) is generated and written into a print buffer. The data in the receive buffer are processed in a FIFO (first in, first out) order. Real-time commands are processed immediately overriding the FIFO order. When the normal processing detects a real-time command in the receive buffer, this command is ignored because it has already been executed in the real-time processing mentioned above.
A data stream for printing text typically contains the byte values of the ASCII codes of the characters to be printed. On the other hand, a data stream for printing images/graphics, for loading a user-defined font into the printer or the like, is typically composed of so-called “image data” representing each pixel or dot of an image/graphic or of a character by one bit to express black and white or multiple bits if more than two colors are to be expressed. When a bit stream of such image data is thought of as a byte stream, the value of each byte in the stream is not restricted to a value of any of the ASCII codes representing characters. In contrast to this, in decimal notation, each value between 0 and 255 is possible, and there is no restriction regarding possible combinations of byte values in such image data stream.
For this reason, an image data stream can happen to include what will be referred to as “false real-time command” hereinafter, namely a data sequence identical to the byte stream of a (true) real-time command. If the printer interprets such data sequence as a real-time command, the false real-time command is carried out even though in fact the data sequence was not meant to be a real-time command. Execution of a false real-time command can cause a variety of problems. For instance, as a result of the execution of the false real-time command the printer might send data to the host computer, which is not ready to receive the data.